Hair Max 6.0
Hair Max 4.0
Source Code


This pluggin is what I define as charityware and can be freely distributed. If you find it useful make what you feel as an appropriate donation to your favorite charity. You cannot charge or make any money from this routine by reselling or bundling them with another package/cd/web page without my permission.

To install this routine just copy the files into your 3ds Max plugin directory.

Alpha ver. 0.93 fixes a a sway bug and a spline cage bug.

Alpha ver. 0.92 fixes a pretty ugly intermittent render bug and also fixes the start field

Alpha ver. 0.91 Fixed Field Rendering and Motion Blur bug I think.. Also added some more dynamics so when the emitter stops moving the hair continue to sway (there is no more secondary motion this is now the sway). See the mtest.max file for a sample. Also added a Debug viewport particle type which tags the first particle with a blue rectangle. I also had to change how the particles are handled at render time. Due to how Max handles rendering frames/fields during render time the number segments in each hair is doubled so that motion in the viewport is identical to the renderer.

Alpha ver. 0.9 Fixed some minor filler hair stuff by making all filler hairs taper right. Made it so you can apply hairs to only selected faces of the emitter. Added a jitter field which allows you add some randomness to the placement of the hairs. Note about jitter right now when you jitter a hair it can come off the emitters surface.

Alpha ver 0.89 Add angle limit and filler hairs. Angle limit basically removes any hairs that are not facing the view based on the angle. Filler hairs are extra hairs created at render time. These hairs are just duplicates of existing hairs that are shifted over and lengths truncated. Wire Strands don't support this yet.

Alpha ver 0.88 Mostly work on the spline cage and minor bug fixes. Added Absolute option for spline control cage, improvement in Spline Control cage speed, added Spline Limit Option and Spline Influence Spinner. Fixed the one spline Control Cage bug, and the Viewport/Render check box bugs,. Added a spline cage tutorial.

Alpha ver 0.875Cutter objects are starting to go in, right now deflectors have dual purpose as deflectors and cutters. This method blows chunks right now since you lose the deflectors options (even though deflectors don't work right now anyway) also will not work with a spline cage. Clumping graph is in but not tested. Am beginning to tweak the motion mainly momentum and vertex deformation still needs to be tweaked(deformed objects can't have truly stiff hair yet).

Alpha ver 0.866 Added a wire strand particle type.

Alpha ver 0.865 Minor changes. Now implementing Max version number system, so the last 4 versions should now be compatible starting at 0.855. Added clumping radius, but the graph still does not work.

Alpha ver 0.855 All the stray anomoulous hairs resulting from the Spline Cage/Controller are now gone I think. Hairs also pick up the length of the splines now. Also some of the clumping code is in, no bitmap mapping for it or spline graph yet.. Once I finish the clumping and cutter code I will begin calling it a beta. Now have a sample showing spline cage and a head.

Alpha ver 0.85Vertex Deformation Motion now supported. Spline cage works much better now but still exhibits some strangeness such as straight hairs and hair not following the splines correctly.

Alpha ver 0.8 Hair strands now pick up the MaterialID of the face that it is emitted from. Basic Spline Cage is in. Moved help file from text file to Word DOC file.

Alpha Ver 0.75 fixes the texture problem, it now correctly pulls the TV from the emitter. Also fixes the first segment for 3 sided strands type. Secondary motion and Motion Transfer are now active. Adds spline graph for secondary motion and motion transfer. There is now a write around for World Space Modifier when using a emitter object with a WSM on it turn on the Emitter has WSM check box otherwise bizarre things happen. Speed and Str. Falloff now means something it used to calculate against space warps now.

Alpha Ver 0.7 Fixes a crash bug for the distribution map. There now a MotionGraph object in the Create/Spline/Default section. The MotionGraph will be used as a graph to control various aspects of the hair. You can use the mid horizontal spline in the MotionGraph to create a graph(Note the scale field does nothing know). Right now you can only use it for the Length Modifier. Note found a bug with World Space SpaceWarps (such as Bones Pro) that effect the emitter causes major problems.

Alpha Ver 0.6 adds secondary motion, motion transfer, and a distribution map. Also increases speed substantial from the 0.5 alpha.

Hair

Hair is particle used to simulate hair. It was mainly aimed at doing long head hair but can also be used for short body hair. Since it is a particle system most particles space warps will work with it NOTE deflectors have not been tested yet so not sure what the effect will be. Basically Hair distributes particles across an emitter object these particles are then formed in hair strands.

Basic Usage

Basic usage of Hair is first to create an emitter object which the hair will sprout from. NOTE the emitter object must have renderable faces and the face topology cannot change, for instance you cannot use a sphere that has animated segment counts however normal deformations that don't change the face/vertex order are fine . It is best that the emitter object have an even distribution of faces. Hair uses the faces of the emitter object as distribution points so areas of the emitter object that have denser face counts will have denser hair strands in that area. Hair strands will initially emit parallel to the normals of face that they are emitter from. NOTE special case if you are using a spline cage the initial hair direction is based on the closest spline relative to the nearest normal.

Once you have created a valid emitter object, you need to create a Hair object which can be found in the Create/Geometry/Particle System tab. Create the object in any viewport a circular icon should appear that represents the hair particle system. Location of the Hair object icon is not important.

Select the Hair Object and go into the Modify tab. You now need to begin setting the fields and controls. The first thing that you need to do is to assign the emitter object. Press the button in the Emitter Shape which will bring up a selection dialog . Select the object that you want form the list to be your emitter object.

Now you need to fill the fields that will control the shape and number hairs that will be generated.

Motion Graph

This plugin uses what I call spline graphs. Right now you can find the Motion Graph (need to change name to just Spline Graph) object in the Create/Shapes/Default (default needs to be changed eventually). This is just a simple spline shape that can be used as a graph to control certain fields.

Bitmap Controllers

Bitmaps are also used to control various fields. Basically it takes a gray scale image and anywhere the image is black the min. value is used and where it is white the max. value is used.

Fields Descriptions


Particles

Viewport Count is the number of strands in the interactive render
Render Count is the number of strands when rendering
# Segments is the number of particles per strand, higher the # Segments smoother the strand locks but more vertices and higher memory usage. Total vertex count = Strands * Segments *3
Base Length - Does nothing now

Angle Limit - if Angle limit is turned on, any hair beyond the angle limit is removed. The angle is the angle between the first segment and the view angle.

Strands/Dots/Ticks determine how the particles are drawn in the viewports

Filler Strands

Filler Multiplier determines how many fillers strands are created.. This a multiplier so if the value is 2 the number strands created is 2xNumber of strands.
Angle Limit - is the same as the regular angle limit except applied to the filler strands. Any strand whose angle between the view and the first segment is greater than the Angle Limit is removed.
Distance - is the max. distance a filler strand will be created from the parent strand. Right now the filler strands do not follow the surface so there is the possibility of filler strands floating off the surface. Min and Max Segments determine the length of the filler strands.

Hair Width

Hair Width is the width of an individual strand of hair
The button below now is to assign a Motion Graph for length of hair over its life. So you can create a changing width over the length of the hair.


Render Info

Render Radio buttons determine what the particles look like at render time. All the particles are standard except 3 sided which is a strand of hair particle. There is now a 1 sided particle which is similar to the Facing particle but it builds strands instead of just a square. The wire strand type is now supported. For it to work you must assign a 2 sided wire material to the particle system. It generates less vertices and faces then the rest at the sacrifice of quality. You have to control the width of the hair through the wire material property.

Generate W Mapping does not work correctly right now, but basically you will be able to add a W coordinate in addition to the UV mapping to be use with a new blend material so you can change the color based on the length.

Emitter Shape

Emitter Shape button brings up a dialog which allows you select an object to emit the particles from.

Emitter has WSM is a fix for emitter objects that have world space modifiers attached to them such as Bones Pro. For some reason WSM cause the particle system to constantly update itself when it does not need to. When you have a WSM assigned to your Emitter Object you should check this button other wise you will get some ugly updates. Also sometimes you need to refresh the particle system by going back to frame 0.

Emitter Object Collision - not implemented but will allow the strands to bounce of the emitter object to prevent cut through.

Selected Face Only - If this is checked only the faces of the emitter that are selected are used.

Jitter - sets up a Max distance that a hair can be shifted to create a more random distribution of hairs.


Length Modifier

Min: is the minimum length of a strand
Max: is the maximum length of a strand
Button - sets a gray scale bitmap used to control the length of strands across the object
Absolute - check does nothing right now.

Note right now to update hair the Min and Max fields you need to press the file selector button and hit OK for the selector dialog box.


Spline Cage

Now brings up a dialog that allows you to select a spline object to be used as a spline control cage. The splines can then be used to shape the direction of the hair. Basically each strand tries to follow the nearest spline. Animated spline are net yet supported, also the algorithm is not yet completed so the hairs don't follow the splines exactly. NEED TO EXPLAIN MORE HERE

Distribution Map - allows you to control the density of the strands through a bitmap. NOTE cannot be an animated map and the emitter object must texture mapping.

Absolute Direction - Determines the orientation to use for the spline cage. If unchecked it tries to align the splines to normals of the emitter. If checked the direction of the splines are used absolutely. Leave this field unchecked when try to do hair that basically the same across the surface such as curly sheep hair. Check this field when you want to do stylized hair that varies differently across the surface.

Spline Limit - When checked this field limits the how the splines affect the strands. Will probably be removed since the results tend to produce distinct boundaries in the hair mass/


Max # Splines - this determines the number of splines that can influence a strand of hair.


Velocity Modifier

Tumble and Tumble Rate are only for Triangle & Snowflake particles

Speed - now works in relation to space warps

Str Falloff is the how fast the Speed of the hair particles diminishes Vs Space Warps. Basically the higher the value the more the speed influences the particles. A value of 0.0 all Space Warps effect the strand 100% all the time and speed is 0%. At 1.0 the space warps effect the particles 0% at the beginning of the strand and 100% at the end of the strand. Speed and Str Falloff and Particle Space Warps are all directly related to each other.


Sway/Motion Transfer/Vertex Deformation

These three graphs control the various secondary motions. Each one varies slightly from the other. Have not decided yet if these three will be combined in some sort of unified format. Since they all are really close. Basically these are used to set the stiffness of the hair when they are moving.

Sway is how much the hair sways after the emitter stops. Sways frames is how long the hairs sways after the emitter has stopped. Waves is the number of waves the hair goes through when swaying. Still needs to do some tweaking to clean up the motion.

Motion Transfer transfers the emitter objects transform to the strand. Every frame the emitter transform is applied to all particles that are alive. This is just expensive for CPU cycles. Also now supports a spline graph so you can control the amount along the length of the hair.

Vertex Deformation is similar to Motion Transfer, but instead of using the transforms of the emitter object it uses the distance a vertex moves. This is useful for mods and WSM which just deform vertices such as Bones Pro or Physique.

Clumping Modifiers - basics are in but not tested thoroughly yet. Clumping allows groups of hairs that are near each other to clump together. If you use clumping best to use a high Clumping chance around .6 to .9

Clumping : this the percent chance of a hair strand clumping together
Clumping Radius : this is the radius of the clump. Put in to prevent hairs that are really far apart from clumping.
Min : When a hair decides to clump this the min. number of hairs in the clump
Max : When a hair decides to clump this the max. number of hairs in the clump

Cutter Modifiers - allows you to use deflectors as a cutting object instead of a deflector. Any strands that intersect the deflector during the cutter frame is cut at that length, Still am going to do some major tweaking with this code. Right now it behaves rather odd in that after the strands have been cut it takes sometime after word for the effect to take place. There will probably be major rewrites to fix this and other problems with this feature.

Use Deflectors as cutters - this turns on the option
Cutter Frame - this is what frame the deflectors becomes active

Timing - Not sure what the effect is here, a left over from the previous particle system. Does nothing needs to be removed.


Spline Cage Tutorial

The spline cage is a tool used to control the shape and length of the strands of hair. It can be used to create curls, parts, and etc. A valid spline cage can be any sort of Spline shape. It works best if the first vertex of the splines in spline cage are near the surface of the emitter.

Basically the each spline of spline cage influences the strands of the hair that are nearest to each spline. Since it is a force based system the strands will not necessarily follow the splines exactly.

This tutorial shows how the absolute control influences the hair.

1. Load CAGE_A.MAX. This file consist of 2 spheres and 2 hair emitter objects.
2. Advance to Frame 20 and notice the difference between the 2 hair volumes.
3. Notice the differences in the 2 hair volumes. The hair on the left tries to follow the normal of the sphere will the one on the right does not. The one on the left does not have the Absolute Direction checked while the one on the right does. Basically when the Absolute Direction is unchecked the hairs strands try to align themselves to the normals of the emitter object. When it is checked the hairs follow the splines cage regardless of the normals of the surface emitter.
4. Normally you want to check the Absolute Direction when you want to do hair that varies differently across the surface such as head hair.


This tutorial shows what the Limit Spline and Max # Spline fields work.

1. Load CAGE_B.MAX.
2. This file consists of just a simple grid, a hair emitter, and a spline cage with 3 splines.
3. Advance to Frame 10.
4. Notice the sharp transition in the hair strands. This is because the Max # Splines is set to 1. This means that each strand will only be influenced by one spline.
5. Now set the Max # Splines to 2 and then 3 and notice the changes in transitions in the hair.

How to explain Spline Limit?


Angle Limit Tutorial And Filler Strands

1. Create a sphere.
2. Create a Hair Particle system and assign the sphere as the emitter.
3. Set the Segments to 10 and Render # to 1000
4. Set the Particle type to 3 sided strands
5. Render Frame 11.
6. Notice that the face count during render time is roughly 54k
7. Now turn on the Angle Limit check box in the Particle section and set the Angle Limit to 90.
8. Render frame 11 and notice the face count has dropped to 27k.
9. What has happened is that any strands facing more than 90 degrees from the viewport has been removed.
10. Now set the Angle Limit to 45 and now render the results.
11. Notice now how the strands have been restricted. Set the Angle limit back to 90. Normally you would use the angle limit for only short hair for longer hair you normally don't want to use angle limit.
12. Now we will create some filler strands.
13. Set the Filler Multiplier to 3.
14. Set the Min Segments and Max Segments to 10.
15. Set the Distance to 3.
16. Render the frame 11. Notice that hair volume is considerably denser since there are now 4 x times as many strands. These strands are only created last. Normally when a strand is created it is grown applied the various forces such as a Spline Cage or space warp. Each of these strands is then duplicated based on the Filler Multiplier and moved slightly based on the Distance field. Filler strands are created after this step so they don't take that much CPU time.
17. Now set the Min Segments to 5 and render. Notice the hair volume filler strands range in length. Right now they may appear stumpy since they are not tapering right which will be fixed.
18. Normally you would use the Filler Strands Angle Limit with longer hairs when you want to fill out a long hair volume with a bunch of short hairs. You would want to cull out any of the back facing filler strands that you would not see anyways.

Bugs
1. Hair is not visible for frames 0 to SegCount while it is growing.
2. If you assign a Distribution Map to an object with no or very few TV it will lock up.
3. W mapping does not work
4. The scale between Space Warps and Hair Str. Is out of wack seems like Space Warps need to be set 100x greater than normal to have effect on the hair.
5. Not all mesh dialog selection fitters do not work.
6. For some reason emitter objects that are boned sometime get the normals flipped
7. Min and Max length don't update until you press the Length Bitmap button and hit OK in the dialog, don't need to select a file.
8. Emitter objects with WSM on them still don't update right a lot of the time you need to advance a frame to update the viewport.
9. When you delete the emitter object the particle system persists.
10. Track view names not all implemented so you see blanks
11. Deflectors don't work quite right
12. Bones Pro cannot be used to deform a Spline Cage since it changes it from a spline to a mesh
13. Looks like Motion blur does not work right and my guess neither does field rendering.

Help - will take you to the help page